# -*- coding: utf-8 -*-
# @Time    :2020/5/29 14:38
# @Author  :lyq

from django.shortcuts import redirect
from MyShop.settings import AUTH_LIST

class Auth(object):
    def __init__(self, get_response):
        self.get_response = get_response

    def __call__(self, request, *args, **kwargs):
        print(request.path)
        if request.path in AUTH_LIST:
            if not request.session.get('user'):
                return redirect('/user/login')
        return self.get_response(request, *args, **kwargs)

